import { deleteTableRow } from '@/api/measurDevice'
import FormModal from '../components/FormModal.vue'
export default {
    inject: ['tableRoot'],
    methods: {
        /**
         * @name: onDeleteClick
         * @msg: 删除事情
         * @return {*}
         */
        onDeleteClick(row) {
            this.$confirm('您确认要删除数据嘛？', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                distinguishCancelAndClose: true,
                type: 'warning',
            }).then(() => {
                deleteTableRow(row ? row.id : this.rowData.id).then((result) => {
                    if (result.code == 200) {
                        this.$message.success(result.msg)
                        this.tableRoot.onSearchChange()
                    }
                })
            })
        },
        /**
         * @name: addOnClick
         * @msg: 新增
         * @return {*}
         */
        addOnClick() {
            new this.$pageModal(
                FormModal,
                {
                    props: {},
                },
                (result) => {
                    if (result) {
                        this.tableRoot.onSearchChange()
                    }
                }
            )
        },
    },
    computed: {},
}
